package com.zzyl.qianfan;

import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.model.chat.ChatResponse;

public class Demo {
    public static void main(String[] args) {
        // 使用安全认证AK/SK鉴权，替换下列示例中参数，安全认证Access Key替换your_iam_ak，Secret Key替换your_iam_sk，如何获取请查看https://cloud.baidu.com/doc/Reference/s/9jwvz2egb
        Qianfan qianfan = new Qianfan("ALTAK2Myihd91WNYJDzofq6Vzg", "79cb662291cd4e548159932f896246db");

        // 指定模型
        ChatResponse resp = qianfan.chatCompletion()
                .model("ERNIE-4.0-8K-Latest")
                .system("你是一个天蚕土豆，名叫李虎")
                .temperature(1.0)
                .topP(1.0)
                .maxOutputTokens(2048)
                .responseFormat("json_object")
                .addMessage("user", "你是谁？请你自身的专业技能给我写首诗？")
                .execute();
        System.out.println(resp.getResult());
    }
}